<?php

namespace api\modules\v1\controllers;

use api\common\controllers\ApiController;

use yii\filters\AccessControl;
use backend\models\Banner;
use backend\models\Check;
use yii;
use api\modules\v1\models\LoginForm;
use api\modules\v1\models\AdminUser;
use yii\base\DynamicModel;

/**
 * Public controller for the `user` module
 */
class BannerController extends ApiController
{

    public function actionMains()
    {
        $banner  = Banner::find()->select('image,ctime,is_display')->orderBy(['ctime' => SORT_DESC])->where(['is_display'=>1])->limit(3)->asArray()->all();
        if(!$banner){
            echo parent::isMessage(400,'您还没有上传轮播图');
        }
        $project_num    = AdminUser::find()->where(['type'=>2])->andFilterWhere(['<>','status',9])->count();
        $checking_num   = Check::find()->where(['status'=>1])->count();
        $checked_num    = Check::find()->where(['status'=>2])->count();
        $data = [
            'banner'  => $banner ,
            'project_num'  => $project_num ,
            'checking_num' => $checking_num ,
            'checked_num'  => $checked_num ,
        ];
        return parent::isMessage(200,'查询成功',$data);
    }


}
